<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://www.netvibes.com/api/0.3/profile">
  <title>New configuration example</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  <link rel="stylesheet" type="text/css" href="http://www.netvibes.com/api/0.3/style.css" />
  <script type="text/javascript" src="http://www.netvibes.com/api/0.3/emulation.js"></script>

</head>
<body>

<?php if(empty($_COOKIE['keyword'])) { ?>

<p>Module is not configured. Please edit it.</p>

<?php } else { ?>

<script type="text/javascript">
    NV_ONLOAD = function()
    {
	//Get variables
	var keyword = <?php echo htmlspecialchars($_COOKIE['keyword']) ?>;
    var city = <?php echo htmlspecialchars($_COOKIE['city']) ?>;
    var distance = <?php echo htmlspecialchars($_COOKIE['distance']) ?>;
  	//Create feed
  	var url = "http://banen.computable.nl/careers/rss/jobs/?q="+keyword+"&qCity="+city+"&qCountry=Netherlands&qField=All&qMatch=all&qMiles="+distance+"&qSort=smart"; 
   	function AjaxShow(xhr)
      {
        // RSS Parsing
        var dom = xhr.responseXML.documentElement;
        var mainTitle = dom.getElementsByTagName("title")[0].firstChild.nodeValue;
        
        // Module Title
        NV_TITLE.innerHTML = mainTitle + ' : ' + firstTitle + ''; 
        // Module Content
		// Access the data for a given entry
         if (dom.getElementsByTagName("title")) {
             for (var i = 0; i < dom.getElementsByTagName("title").length; i++) {
		         html += "<div>"
		         + "<a target='_blank' href='" + dom.getElementsByTagName("link")[i].firstChild.nodeValue + "'>"
		         + var firstTitle = dom.getElementsByTagName("title")[i].firstChild.nodeValue
		         + "</a> ";
				 html += "<br><i>" + var firstTitle = dom.getElementsByTagName("description")[i].firstChild.nodeValue + "</i>";
             }
                 html += "</div>";
         }
        NV_CONTENT.innerHTML = '<div style="text-align:center">' + html + '</div>'; 
      }
      var request = new Ajax.Request(NV_XML_REQUEST_URL + '?url=' + escape(url), { method: 'get', onSuccess: AjaxShow });
    }
    </script>

<?php } ?>

<form class="configuration" method="post" action="">

  <label>keyword :</label> <input name="keyword" type="text" value="" /><br />
  <label>city :</label> <input name="city" type="text" value="" /><br />
  <label>distance :</label> <input name="distance" type="text" value="" /><br />
  <input type="submit" value="ok" />

</form>

</body>
</html>
